3.4.11 \(\int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx\) [311]

3.4.11.1 Optimal result
3.4.11.2 Mathematica [C] (verified)
3.4.11.3 Rubi [A] (verified)
3.4.11.4 Maple [A] (verified)
3.4.11.5 Fricas [A] (verification not implemented)
3.4.11.6 Sympy [C] (verification not implemented)
3.4.11.7 Maxima [A] (verification not implemented)
3.4.11.8 Giac [A] (verification not implemented)
3.4.11.9 Mupad [B] (verification not implemented)

3.4.11.1 Optimal result

Integrand size = 32, antiderivative size = 69 \[ \int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {b B x}{a^2+b^2}+\frac {B \log (\sin (c+d x))}{a d}-\frac {b^2 B \log (a \cos (c+d x)+b \sin (c+d x))}{a \left (a^2+b^2\right ) d} \]

output
-b*B*x/(a^2+b^2)+B*ln(sin(d*x+c))/a/d-b^2*B*ln(a*cos(d*x+c)+b*sin(d*x+c))/ 
a/(a^2+b^2)/d
 
3.4.11.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.15 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.14 \[ \int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {B \left (a (a+i b) \log (i-\cot (c+d x))+a (a-i b) \log (i+\cot (c+d x))+2 b^2 \log (b+a \cot (c+d x))\right )}{2 a \left (a^2+b^2\right ) d} \]

input
Integrate[(Cot[c + d*x]*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x])^2,x 
]
 
output
-1/2*(B*(a*(a + I*b)*Log[I - Cot[c + d*x]] + a*(a - I*b)*Log[I + Cot[c + d 
*x]] + 2*b^2*Log[b + a*Cot[c + d*x]]))/(a*(a^2 + b^2)*d)
 
3.4.11.3 Rubi [A] (verified)

Time = 0.40 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.01, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.219, Rules used = {2011, 3042, 4054, 3042, 25, 3956, 4013}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx\)

\(\Big \downarrow \) 2011

\(\displaystyle B \int \frac {\cot (c+d x)}{a+b \tan (c+d x)}dx\)

\(\Big \downarrow \) 3042

\(\displaystyle B \int \frac {1}{\tan (c+d x) (a+b \tan (c+d x))}dx\)

\(\Big \downarrow \) 4054

\(\displaystyle B \left (-\frac {b^2 \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a \left (a^2+b^2\right )}+\frac {\int \cot (c+d x)dx}{a}-\frac {b x}{a^2+b^2}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle B \left (-\frac {b^2 \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a \left (a^2+b^2\right )}+\frac {\int -\tan \left (c+d x+\frac {\pi }{2}\right )dx}{a}-\frac {b x}{a^2+b^2}\right )\)

\(\Big \downarrow \) 25

\(\displaystyle B \left (-\frac {b^2 \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a \left (a^2+b^2\right )}-\frac {\int \tan \left (\frac {1}{2} (2 c+\pi )+d x\right )dx}{a}-\frac {b x}{a^2+b^2}\right )\)

\(\Big \downarrow \) 3956

\(\displaystyle B \left (-\frac {b^2 \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a \left (a^2+b^2\right )}-\frac {b x}{a^2+b^2}+\frac {\log (-\sin (c+d x))}{a d}\right )\)

\(\Big \downarrow \) 4013

\(\displaystyle B \left (-\frac {b^2 \log (a \cos (c+d x)+b \sin (c+d x))}{a d \left (a^2+b^2\right )}-\frac {b x}{a^2+b^2}+\frac {\log (-\sin (c+d x))}{a d}\right )\)

input
Int[(Cot[c + d*x]*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x])^2,x]
 
output
B*(-((b*x)/(a^2 + b^2)) + Log[-Sin[c + d*x]]/(a*d) - (b^2*Log[a*Cos[c + d* 
x] + b*Sin[c + d*x]])/(a*(a^2 + b^2)*d))
 

3.4.11.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 2011
Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> 
 Simp[(b/d)^m   Int[u*(c + d*v)^(m + n), x], x] /; FreeQ[{a, b, c, d, n}, x 
] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c + d*x 
, a + b*x])
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4013
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* 
(x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si 
n[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && 
 NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]
 

rule 4054
Int[1/(((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f 
_.)*(x_)])), x_Symbol] :> Simp[(a*c - b*d)*(x/((a^2 + b^2)*(c^2 + d^2))), x 
] + (Simp[b^2/((b*c - a*d)*(a^2 + b^2))   Int[(b - a*Tan[e + f*x])/(a + b*T 
an[e + f*x]), x], x] - Simp[d^2/((b*c - a*d)*(c^2 + d^2))   Int[(d - c*Tan[ 
e + f*x])/(c + d*Tan[e + f*x]), x], x]) /; FreeQ[{a, b, c, d, e, f}, x] && 
NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0]
 
3.4.11.4 Maple [A] (verified)

Time = 0.24 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.16

method result size
parallelrisch \(\frac {B \left (-2 a b d x +2 \ln \left (\tan \left (d x +c \right )\right ) a^{2}+2 \ln \left (\tan \left (d x +c \right )\right ) b^{2}-\ln \left (\sec ^{2}\left (d x +c \right )\right ) a^{2}-2 b^{2} \ln \left (a +b \tan \left (d x +c \right )\right )\right )}{2 a d \left (a^{2}+b^{2}\right )}\) \(80\)
derivativedivides \(\frac {B \left (\frac {\ln \left (\tan \left (d x +c \right )\right )}{a}+\frac {-\frac {a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}-b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {b^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{a \left (a^{2}+b^{2}\right )}\right )}{d}\) \(81\)
default \(\frac {B \left (\frac {\ln \left (\tan \left (d x +c \right )\right )}{a}+\frac {-\frac {a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}-b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {b^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{a \left (a^{2}+b^{2}\right )}\right )}{d}\) \(81\)
norman \(\frac {-\frac {b B a x}{a^{2}+b^{2}}-\frac {b^{2} B x \tan \left (d x +c \right )}{a^{2}+b^{2}}}{a +b \tan \left (d x +c \right )}+\frac {B \ln \left (\tan \left (d x +c \right )\right )}{a d}-\frac {B a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{2}+b^{2}\right )}-\frac {B \,b^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{a d \left (a^{2}+b^{2}\right )}\) \(127\)
risch \(-\frac {i x B}{i b -a}-\frac {2 i x B}{a}-\frac {2 i B c}{a d}+\frac {2 i b^{2} B x}{a \left (a^{2}+b^{2}\right )}+\frac {2 i b^{2} B c}{a d \left (a^{2}+b^{2}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{a d}-\frac {b^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{a d \left (a^{2}+b^{2}\right )}\) \(149\)

input
int(cot(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x,method=_RETURNVER 
BOSE)
 
output
1/2/a/d/(a^2+b^2)*B*(-2*a*b*d*x+2*ln(tan(d*x+c))*a^2+2*ln(tan(d*x+c))*b^2- 
ln(sec(d*x+c)^2)*a^2-2*b^2*ln(a+b*tan(d*x+c)))
 
3.4.11.5 Fricas [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.51 \[ \int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {2 \, B a b d x + B b^{2} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (B a^{2} + B b^{2}\right )} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, {\left (a^{3} + a b^{2}\right )} d} \]

input
integrate(cot(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm= 
"fricas")
 
output
-1/2*(2*B*a*b*d*x + B*b^2*log((b^2*tan(d*x + c)^2 + 2*a*b*tan(d*x + c) + a 
^2)/(tan(d*x + c)^2 + 1)) - (B*a^2 + B*b^2)*log(tan(d*x + c)^2/(tan(d*x + 
c)^2 + 1)))/((a^3 + a*b^2)*d)
 
3.4.11.6 Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 1.43 (sec) , antiderivative size = 672, normalized size of antiderivative = 9.74 \[ \int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\begin {cases} \frac {\tilde {\infty } B x \cot {\left (c \right )}}{\tan {\left (c \right )}} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {B \left (- \frac {\log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {\log {\left (\tan {\left (c + d x \right )} \right )}}{d}\right )}{a} & \text {for}\: b = 0 \\\frac {B \left (- x - \frac {1}{d \tan {\left (c + d x \right )}}\right )}{b} & \text {for}\: a = 0 \\\frac {B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i B d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {2 i B \log {\left (\tan {\left (c + d x \right )} \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {2 B \log {\left (\tan {\left (c + d x \right )} \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {B}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\\frac {B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i B d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {2 i B \log {\left (\tan {\left (c + d x \right )} \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {2 B \log {\left (\tan {\left (c + d x \right )} \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {B}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {x \left (B a + B b \tan {\left (c \right )}\right ) \cot {\left (c \right )}}{\left (a + b \tan {\left (c \right )}\right )^{2}} & \text {for}\: d = 0 \\- \frac {B a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{3} d + 2 a b^{2} d} + \frac {2 B a^{2} \log {\left (\tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} - \frac {2 B a b d x}{2 a^{3} d + 2 a b^{2} d} - \frac {2 B b^{2} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} + \frac {2 B b^{2} \log {\left (\tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} & \text {otherwise} \end {cases} \]

input
integrate(cot(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))**2,x)
 
output
Piecewise((zoo*B*x*cot(c)/tan(c), Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (B*(-lo 
g(tan(c + d*x)**2 + 1)/(2*d) + log(tan(c + d*x))/d)/a, Eq(b, 0)), (B*(-x - 
 1/(d*tan(c + d*x)))/b, Eq(a, 0)), (B*d*x*tan(c + d*x)/(2*b*d*tan(c + d*x) 
 - 2*I*b*d) - I*B*d*x/(2*b*d*tan(c + d*x) - 2*I*b*d) - I*B*log(tan(c + d*x 
)**2 + 1)*tan(c + d*x)/(2*b*d*tan(c + d*x) - 2*I*b*d) - B*log(tan(c + d*x) 
**2 + 1)/(2*b*d*tan(c + d*x) - 2*I*b*d) + 2*I*B*log(tan(c + d*x))*tan(c + 
d*x)/(2*b*d*tan(c + d*x) - 2*I*b*d) + 2*B*log(tan(c + d*x))/(2*b*d*tan(c + 
 d*x) - 2*I*b*d) + B/(2*b*d*tan(c + d*x) - 2*I*b*d), Eq(a, -I*b)), (B*d*x* 
tan(c + d*x)/(2*b*d*tan(c + d*x) + 2*I*b*d) + I*B*d*x/(2*b*d*tan(c + d*x) 
+ 2*I*b*d) + I*B*log(tan(c + d*x)**2 + 1)*tan(c + d*x)/(2*b*d*tan(c + d*x) 
 + 2*I*b*d) - B*log(tan(c + d*x)**2 + 1)/(2*b*d*tan(c + d*x) + 2*I*b*d) - 
2*I*B*log(tan(c + d*x))*tan(c + d*x)/(2*b*d*tan(c + d*x) + 2*I*b*d) + 2*B* 
log(tan(c + d*x))/(2*b*d*tan(c + d*x) + 2*I*b*d) + B/(2*b*d*tan(c + d*x) + 
 2*I*b*d), Eq(a, I*b)), (x*(B*a + B*b*tan(c))*cot(c)/(a + b*tan(c))**2, Eq 
(d, 0)), (-B*a**2*log(tan(c + d*x)**2 + 1)/(2*a**3*d + 2*a*b**2*d) + 2*B*a 
**2*log(tan(c + d*x))/(2*a**3*d + 2*a*b**2*d) - 2*B*a*b*d*x/(2*a**3*d + 2* 
a*b**2*d) - 2*B*b**2*log(a/b + tan(c + d*x))/(2*a**3*d + 2*a*b**2*d) + 2*B 
*b**2*log(tan(c + d*x))/(2*a**3*d + 2*a*b**2*d), True))
 
3.4.11.7 Maxima [A] (verification not implemented)

Time = 0.29 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.28 \[ \int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {2 \, B b^{2} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{3} + a b^{2}} + \frac {2 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} + \frac {B a \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} - \frac {2 \, B \log \left (\tan \left (d x + c\right )\right )}{a}}{2 \, d} \]

input
integrate(cot(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm= 
"maxima")
 
output
-1/2*(2*B*b^2*log(b*tan(d*x + c) + a)/(a^3 + a*b^2) + 2*(d*x + c)*B*b/(a^2 
 + b^2) + B*a*log(tan(d*x + c)^2 + 1)/(a^2 + b^2) - 2*B*log(tan(d*x + c))/ 
a)/d
 
3.4.11.8 Giac [A] (verification not implemented)

Time = 0.46 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.33 \[ \int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {2 \, B b^{3} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{3} b + a b^{3}} + \frac {2 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} + \frac {B a \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} - \frac {2 \, B \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a}}{2 \, d} \]

input
integrate(cot(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm= 
"giac")
 
output
-1/2*(2*B*b^3*log(abs(b*tan(d*x + c) + a))/(a^3*b + a*b^3) + 2*(d*x + c)*B 
*b/(a^2 + b^2) + B*a*log(tan(d*x + c)^2 + 1)/(a^2 + b^2) - 2*B*log(abs(tan 
(d*x + c)))/a)/d
 
3.4.11.9 Mupad [B] (verification not implemented)

Time = 7.40 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.43 \[ \int \frac {\cot (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{a\,d}-\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,d\,\left (a-b\,1{}\mathrm {i}\right )}-\frac {B\,b^2\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{a\,d\,\left (a^2+b^2\right )}-\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (-b+a\,1{}\mathrm {i}\right )} \]

input
int((cot(c + d*x)*(B*a + B*b*tan(c + d*x)))/(a + b*tan(c + d*x))^2,x)
 
output
(B*log(tan(c + d*x)))/(a*d) - (B*log(tan(c + d*x) + 1i))/(2*d*(a - b*1i)) 
- (B*log(tan(c + d*x) - 1i)*1i)/(2*d*(a*1i - b)) - (B*b^2*log(a + b*tan(c 
+ d*x)))/(a*d*(a^2 + b^2))